home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 46
/
Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso
/
-serious-
/
comms
/
www
/
httpresume
/
rexx
/
demo.rexx
next >
Wrap
OS/2 REXX Batch file
|
1999-09-06
|
2KB
|
90 lines
/* $VER: HTTPResume ARexx demo 1.2 (14.1.99) */
/* */
/* Reads ListFile which is in format: */
/* URL */
/* File name */
/* and downloads the whole list */
/* */
/* Please note that I'm not too fluent in */
/* ARexx, so excuse all the errors possibly */
/* made. Insert standard disclaimer here. */
OPTIONS RESULTS
Path = 'PathTo:HTTPResume'
ListFile = 'RAM:SomeFile.txt'
IF ~SHOW('L', 'rexxsupport.library') THEN IF ~ADDLIB('rexxsupport.library', 0, -30, 0) THEN DO
SAY "Couldn't open rexxsupport.library!"
EXIT 10
END
HPort = ADDRESS()
IF (LEFT(HPort, 11) ~= 'HTTPRESUME.') THEN DO
FromHTTPResume = 0
TmpFile = 'T:HTTPResume.tmp.'||random(,,time('s'))||'.'random(,,)
ADDRESS COMMAND 'Run '||Path||' GUI NOERRREQ RXPORTFILE='||TmpFile
Delay(150) /* Wait 3 seconds for HTTPResume to start */
Suc = OPEN(PortFile, TmpFile, 'R')
IF Suc ~= 1 THEN DO
SAY 'Couldn''t open temporary file!'
EXIT 20
END
Port = READLN(PortFile)
CLOSE(PortFile)
CALL DELETE(TmpFile)
IF Port = '***' THEN DO
SAY 'HTTPResume couldn''t open its ARexx port!'
EXIT 20
END
ADDRESS(Port)
END
ELSE DO
FromHTTPResume = 1
QUERY NOERRREQ
OLDERRREQ = RESULT
SET NOERRREQ
END
Suc = OPEN(LFile, ListFile, 'R')
IF Suc ~= 1 THEN DO
SAY 'Couldn''t open list file!'
IF FromHTTPResume = 0 THEN QUIT
EXIT 20
END
DROP Data.
Count = 0
DO WHILE ~EOF(LFile)
Count = Count + 1
Line = READLN(LFile)
Data.URL.Count = Line
IF ~EOF(LFile) THEN DO
Line = READLN(LFile)
Data.Outfile.Count = Line
END
ELSE Count = Count - 1
END
CALL CLOSE(LFile)
DO I = 1 TO Count
SET OUTFILE Data.Outfile.I /* Always set filename first because */
SET URL Data.URL.I /* URL will get changed if file's */
START /* comment has URL in it */
Working = 1
DO WHILE Working > 0
CALL Delay(150) /* Pause 3 seconds */
QUERY FINISHED
Working = Result
END
END
IF FromHTTPResume = 1 THEN SET NOERRREQ OLDERRREQ
ELSE QUIT